<?php 
 namespace app\Admin\Controller;

 use think\Controller;
 use think\Db;
 use think\Request;

 class login extends Controller
 {
 	public function index()	{
 	if  (Request::instance()->isPost()) {
 		$username = input('username');
 		$password = input('password');
 		$validate = \think\Loader::validate('Login');
 		if($users=Db::name('users')->where('username','=',$username)->find());
		{	
			if($users['password'] == $password)
			{
 				session('username',$users['username']);
 				return $this->success('登录成功，正在跳转','index/index');
 			} else {
 				return $this->error('密码错误','Login/index');
 			}
 		} 
 	}
 		return $this->fetch('index');
 	}

 	public  function logout()	{
 		session(null);
 		$this->success('退出成功', 'Login/index');
 	}

 	public function captcha()
 	{
		$captcha = new \think\captcha\Captcha();
		$captcha = entry();
 	}
}
